var gulp = require('gulp'),
    less = require('gulp-less'),
    mincss = require('gulp-minify-css'),
    jshint = require('gulp-jshint'),
    uglify = require('gulp-uglify'),
    concat = require('gulp-concat'),
    rename = require('gulp-rename'),
    del = require('del');
 
// css
gulp.task('demo_css', function() {
  return gulp.src('source_css/demo_1.less')
    .pipe(less())
    .pipe(mincss())
    .pipe(rename('demo.min.css'))
    .pipe(gulp.dest('css'));
});
gulp.task('bootstrap_css', function() {
  return gulp.src('source_css/less/bootstrap.less')
    .pipe(less())
    .pipe(mincss())
    .pipe(rename('bootstrap.min.css'))
    .pipe(gulp.dest('css'));
});
 
// js
gulp.task('js', function() {
  return gulp.src('source_js/*.js')
    .pipe(jshint())
    .pipe(concat('demo.min.js'))
    .pipe(uglify())
    .pipe(gulp.dest('js'));
});
 
// Clean
gulp.task('clean', function() {
    del(['css/*.css', 'js/*.js'])
});
 
// Default task
gulp.task('build', ['clean'], function() {
    gulp.start('demo_css','bootstrap_css', 'js');
});
